<template>
  <div>
        <van-cell-group>
          <van-field
            v-model="form.name"
            error
            required
            label="公司业务"
            placeholder="请输入业务名"
            style="width: 300px"
          />
        </van-cell-group>

    <van-button color="linear-gradient(to right, #ff6034, #ee0a24)" style="width: 400px" round @click="add_yw">提交</van-button>
    <br>
    <br>
    <br>
    <table border="1" cellspacing="0" align="center">
      <tr>
        <td>业务</td>
        <td>操作</td>

      </tr>
      <tr v-for="i in  listq">
        <td>{{i.name}}</td>
        <td>
          <van-button type="info" @click="peizhi(i.id)">参数配置</van-button>
          <van-button type="info" @click="tiao(i.id)">用户</van-button>
        </td>

      </tr>
    </table>
  </div>
</template>

<script>
export default {
  name: "add_yw",
  data() {
    return {
      form:{},
      listq :[]
    }
  },
  methods: {
    add_yw() {
      this.$axios.post('users/yw', this.form).then(res => {
        if (res.data.code == 200) {
          alert('ok')
          this.form={}
          this.get_yw()
        } else {
          alert('no')
        }
      })
    },
    get_yw(){
      this.$axios.get('users/yw').then(res=>{
        this.listq =res.data.list
      })
    },
    peizhi(id){
      this.$router.push({path:'/pz',query:{'id':id}})
    },
    tiao(id){
      this.$router.push({path:'/yhwork',query:{'id':id}})
    }
  },
  mounted() {
    this.get_yw()
  }
}
</script>

<style scoped>

</style>
